UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DbJb5oxZP5/xzy7NZu9snC4XXC0IXgGUZfq0sgsGIFM=' 
WHERE 
  key_id = 'a2d0387b0475e2a58df3d5b520fc3f876fd0a6497ee49683beaae2d0b52f1340' 
  AND (
    token = 'DbJb5oxZP5/xzy7NZu9snC4XXC0IXgGUZfq0sgsGIFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042