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