UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ciVKX8erWnHj/XL4YTrPcBL5GeWmDGimRHZNlFTkdVc=' 
WHERE 
  key_id = '7ce24a0419e098c0b1e880bd1013f56424ccb6b6d6fffde577536612e4999033' 
  AND (
    token = 'ciVKX8erWnHj/XL4YTrPcBL5GeWmDGimRHZNlFTkdVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018