UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GFPrnSaTEE7cgmTI6nWm2sySigXpVIbty01kDdPjDKo=' 
WHERE 
  key_id = 'c18b2eecdcbe28ef0e167569d232b0264e5228fa1130721bda121c759c2d1ee6' 
  AND (
    token = 'GFPrnSaTEE7cgmTI6nWm2sySigXpVIbty01kDdPjDKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029