UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Rd5GXWzO6gLZqlNq05OkYrWPkwTj3aEwbUxTfzItEQ=' 
WHERE 
  key_id = '9c38400443a23ddbbde56fd8546043eb78189410a2672c0c57e4c7ebf91052cf' 
  AND (
    token = '8Rd5GXWzO6gLZqlNq05OkYrWPkwTj3aEwbUxTfzItEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047