UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B/GlKwQZbe+0mJleiIvm5iib4hYIba85b5mzUN7slfA=' 
WHERE 
  key_id = 'c840b0ec06750d430f2c65d9f155f9b2f5fa8dc3cb035d41e6ed3efec33f5dd5' 
  AND (
    token = 'B/GlKwQZbe+0mJleiIvm5iib4hYIba85b5mzUN7slfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032