UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NMzHX5ybK3EzrFyl0S8ArONvzd3DwDUtzbTpk181Nlc='
WHERE
key_id = 'e4bf617955c647fe2d1ab06c165cd838a04cbffff1a64bc80617042063df5934'
AND (
token = 'NMzHX5ybK3EzrFyl0S8ArONvzd3DwDUtzbTpk181Nlc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)