UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gtIE+bKZL+h5gk5cBtG4Rprx4zTYX2eCToIP97mii68='
WHERE
key_id = '368311d1c7aee180fedb12130844bedaf97182926fb733d366eb6d2dfe4b0310'
AND (
token = 'gtIE+bKZL+h5gk5cBtG4Rprx4zTYX2eCToIP97mii68='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)