UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4c4MykuR37s5E2EnA9N8Cfj8Npi50rcUh0o1CXXIMjI=' 
WHERE 
  key_id = '4904d7ea980bd25fb53896c16be0a6c67cc00449cb63f37beb5219cf935301f0' 
  AND (
    token = '4c4MykuR37s5E2EnA9N8Cfj8Npi50rcUh0o1CXXIMjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029