UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nzfcWYMPSDojFJZy2WidJSKbnL+sASf7hUitQJznu2M=' 
WHERE 
  key_id = 'a36ecebc62ddc56819686778f5aa482266bb974e695b4fae0a0a55b27dfdff9b' 
  AND (
    token = 'nzfcWYMPSDojFJZy2WidJSKbnL+sASf7hUitQJznu2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052