UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SPaIlJggpm1h3NcYXzrGFIBchjiztlyoMX7pwl9y69k=' 
WHERE 
  key_id = '72fa07cae6c343975295567a905171b4321ae08f5fb3ccb127fdbb605b09933d' 
  AND (
    token = 'SPaIlJggpm1h3NcYXzrGFIBchjiztlyoMX7pwl9y69k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027