UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W7MfjFcOqGgemEna6FCEGYXpK9PvJj2n+cz8wuBkNGw=' 
WHERE 
  key_id = '1e4d6ec8067c5b9fd13afe8083fb0c438f0b37948390a8fddca931fb4f202e38' 
  AND (
    token = 'W7MfjFcOqGgemEna6FCEGYXpK9PvJj2n+cz8wuBkNGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034