UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NOs5maZWOtcf0hrkW+c2i4dcCCogcP6PagXELJGp3ns=' 
WHERE 
  key_id = '703a4fee9603c638208da470a308eb286511855a9f205d02bea37a6d6b743af7' 
  AND (
    token = 'NOs5maZWOtcf0hrkW+c2i4dcCCogcP6PagXELJGp3ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024