UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZsQtSNvWdaXp1UhXJrjykj+Dti4xM4fH73mbm/C8vK0=' 
WHERE 
  key_id = '57ba62cf92d0d0a3483f8a60cb65b0dce261aeec032849b92d99228b75185092' 
  AND (
    token = 'ZsQtSNvWdaXp1UhXJrjykj+Dti4xM4fH73mbm/C8vK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037