UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tYvfQK7Lt6RSxsMt8/gr9qnOnRTKYQJTJhcWxjezaBE=' 
WHERE 
  key_id = 'f3fc2dc90b657543446a2b927119d5c18f98827bccce232bc4b5e9429a4a0d18' 
  AND (
    token = 'tYvfQK7Lt6RSxsMt8/gr9qnOnRTKYQJTJhcWxjezaBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028