UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RSRX2BgIxKjXO1SMz0IYkFsyBhphd3YNEGyyiU5bLuU='
WHERE
key_id = '0a1538772ee8f6ba4cf0cbc28f417f4e31db61a4fcec6ee7e83f7aab860c0e0b'
AND (
token = 'RSRX2BgIxKjXO1SMz0IYkFsyBhphd3YNEGyyiU5bLuU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)