UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zP99TTi6p67PVTAcTqk6SOJfcl/2CkcHrUxsX8WqiXQ=' 
WHERE 
  key_id = '3d164a560a495c4b611237787187e762c9b940899d7f1a861d613440befad7e4' 
  AND (
    token = 'zP99TTi6p67PVTAcTqk6SOJfcl/2CkcHrUxsX8WqiXQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025