UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0ST29LtK9PvZ1KuhQIHVN37StaXeT+Lp4fyDUQuJjoI=' 
WHERE 
  key_id = 'd848d18042660b960081029bdc1b00832e056e4b3d539aa108476e0932814c33' 
  AND (
    token = '0ST29LtK9PvZ1KuhQIHVN37StaXeT+Lp4fyDUQuJjoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032