UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2rXLBoIjfGiWC37ZS54sfpxkE61UcI/hqzf+p/EX8IQ=' 
WHERE 
  key_id = 'b8317a0a77fb1d543c1e8f5a88cd704bf29ae47130ae38cf4b5410426d9ee9d7' 
  AND (
    token = '2rXLBoIjfGiWC37ZS54sfpxkE61UcI/hqzf+p/EX8IQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037