UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xDfGfZS60Z9vZmaCDrhhPkKWlXEGo1J457NZPsSkE2o=' 
WHERE 
  key_id = '2a4cd5b430ded24ca586cb1fbce2f739d951e9748eed6b00b554a008a0597466' 
  AND (
    token = 'xDfGfZS60Z9vZmaCDrhhPkKWlXEGo1J457NZPsSkE2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030