UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vmrqdLPKHDOmSxLPlHLzJzTEdoRDCleVP8ogieu5ftM=' 
WHERE 
  key_id = '6b05642d32ec6863e05f987b8180a305d519363c7ae4486e0666b980d54eabbe' 
  AND (
    token = 'vmrqdLPKHDOmSxLPlHLzJzTEdoRDCleVP8ogieu5ftM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037