UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OQ+lbaETrvogoLLhK40s6bzj8MfRILHJDYePmeVAWPw=' 
WHERE 
  key_id = 'b846196a9ba368b2678b76a32264ca49977d5f39a87f6b60faf1ffec7fbb1a7f' 
  AND (
    token = 'OQ+lbaETrvogoLLhK40s6bzj8MfRILHJDYePmeVAWPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027