UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r8aQj2LAuRVWiEN+zoY23lRdUtISDB5LdCtL8gnffF4=' 
WHERE 
  key_id = 'b8ed95e69b2b440a7faf2fc969f043f0895c6832b2e27b60ab6f670a73354a1d' 
  AND (
    token = 'r8aQj2LAuRVWiEN+zoY23lRdUtISDB5LdCtL8gnffF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027