UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bTHPI66DkV4EA4b2oqXtcsZP3mq9TObjsU33uLTv/jA='
WHERE
key_id = '522e2778b73600ad9fed5c1731849b3b409d6fa780833902f85da0ca2324c3e4'
AND (
token = 'bTHPI66DkV4EA4b2oqXtcsZP3mq9TObjsU33uLTv/jA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)