UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dIJRm3xaLspHA2fJJ5inJIEKHK2LcYpIs+qweb3oZfk='
WHERE
key_id = 'a9e28fdeb705b8644ef57ca94df059f05ac81ed5f6d2b2f62feee93e5dbeb72b'
AND (
token = 'dIJRm3xaLspHA2fJJ5inJIEKHK2LcYpIs+qweb3oZfk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)