UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6mF5Fy34TGpmKJNjRj2le4UEVAPm+C2gM5n25SWkWQk=' 
WHERE 
  key_id = '51217a9cc27cbbd57e6434e91df4898add70515f2f61fcabdd83076f2c780913' 
  AND (
    token = '6mF5Fy34TGpmKJNjRj2le4UEVAPm+C2gM5n25SWkWQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025