UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j7+YkkhTMCxAlWGTe0Xs/sjbx7MLDAPRsS54GlAyai8='
WHERE
key_id = '235d59dd710582030963ba22eba692e8f83c33be20cb245dc0e228bdb96ddc16'
AND (
token = 'j7+YkkhTMCxAlWGTe0Xs/sjbx7MLDAPRsS54GlAyai8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)