UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BkvxziJ3peksmTzQKqjwWSLmpj+A8Cn89u32YR002AQ=' 
WHERE 
  key_id = '142b9543e85099d76e6f44b2a91299ca3efda90742a63aee7e362982373f2f94' 
  AND (
    token = 'BkvxziJ3peksmTzQKqjwWSLmpj+A8Cn89u32YR002AQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045