UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1uWp0liyplFEFVWdeTUf/iJuxi5ABGEkOGUMCiU/srE=' 
WHERE 
  key_id = '4b6b3233f0741eb2d848e82f949769832387e357b9324c561131a99061b6ced8' 
  AND (
    token = '1uWp0liyplFEFVWdeTUf/iJuxi5ABGEkOGUMCiU/srE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00124