UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwKgLNEdUqRWMx59ovAmsquVTYd37S4mutq0uq+b4gY=' 
WHERE 
  key_id = '718363c3ac97a96494243f3a1a4217db3651a75619e06323c57499ff1e6eace4' 
  AND (
    token = 'iwKgLNEdUqRWMx59ovAmsquVTYd37S4mutq0uq+b4gY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036