UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8Dy5OsDriOP3L9AAh8245hH+YcXPXU4kXbDin6Tp1o=' 
WHERE 
  key_id = '21cef7ff188e9239afab90e8f0e733c84f7b09fd587f469c3fce0483006bd375' 
  AND (
    token = 'w8Dy5OsDriOP3L9AAh8245hH+YcXPXU4kXbDin6Tp1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030