UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u4OBMK0tTZYS1Y3FV3/32IUzi3FIz1xt3lG2RfoMEFI=' 
WHERE 
  key_id = '3522327acba65ff6b32cb084641f3694fed40569b6fd1e09ddde60bb05652522' 
  AND (
    token = 'u4OBMK0tTZYS1Y3FV3/32IUzi3FIz1xt3lG2RfoMEFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047