UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y9gDRHeW7qmoeJ56w0GFUtSIH3ckypX/osGpSd6Rd48='
WHERE
key_id = 'bd064a6eee20b38009fdcba0295356bf2a2e9bead860131d2d15ca9352f7e5de'
AND (
token = 'Y9gDRHeW7qmoeJ56w0GFUtSIH3ckypX/osGpSd6Rd48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)