UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BRMsj1AXF1UR7wPdAfMB11HlKL/SejLwPIUvmbFM3Ds=' 
WHERE 
  key_id = '30578e17b85a579b88f8f0ec4723ce621e047f69155b807c4ddf1000459d4af6' 
  AND (
    token = 'BRMsj1AXF1UR7wPdAfMB11HlKL/SejLwPIUvmbFM3Ds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046