UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OKeu+V0nFoWs+SIi+VleddedyIQW4mx+OoUwo4KwpUQ=' 
WHERE 
  key_id = '1d87f7eef2636569f14946ab51db2e90848d6373cd5ba0621dedfaef35817206' 
  AND (
    token = 'OKeu+V0nFoWs+SIi+VleddedyIQW4mx+OoUwo4KwpUQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043