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

Query time 0.00024