UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7SAC0DjsVbuL3oQ+wFATcfeLNn1UooTp21tqqyIz7a8='
WHERE
key_id = '2bf2f7e27547090d49ce8f517e84794e5a93ef11d064af71e49d3df696909321'
AND (
token = '7SAC0DjsVbuL3oQ+wFATcfeLNn1UooTp21tqqyIz7a8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)