UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wSt+T5wm4GlcndwaQZcyEcRpy0WWqjv8L8GnV7tHhF4=' 
WHERE 
  key_id = '4cdf88deefbaa02cb12d94d8747590fa08899716a22bd927202fa08e39aa9944' 
  AND (
    token = 'wSt+T5wm4GlcndwaQZcyEcRpy0WWqjv8L8GnV7tHhF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023