UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CS+vTUIfXeu/MyYtO1OuOcHurmiqspUJU1+825V5UYE=' 
WHERE 
  key_id = '719cc09adc3d782c939de26708846f90d506b0c277fa5adeaa562c0e907f00a2' 
  AND (
    token = 'CS+vTUIfXeu/MyYtO1OuOcHurmiqspUJU1+825V5UYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031