UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QIsUkXQmu7LLeex0Yv6sw7p1bIHvV9P8rFRlYExpI4I='
WHERE
key_id = '48e3a99c70587f4cdbc23d67c58fe5f08e0a6f3698a157e597593790c88c27a3'
AND (
token = 'QIsUkXQmu7LLeex0Yv6sw7p1bIHvV9P8rFRlYExpI4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)