UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AazggJYVTisuA7F3vzvO2zD2uO0ZVftBvGayWWX6K24=' 
WHERE 
  key_id = '273e95a13fa3b8361b4759be73064200e58ab8518a4a821d89110d5dfa446570' 
  AND (
    token = 'AazggJYVTisuA7F3vzvO2zD2uO0ZVftBvGayWWX6K24=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037