UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vly3AtEQU2mYGi7qwHy/3c5XM9b3bOpUfMArbOAmwSY='
WHERE
key_id = '178a7fbf9b8ad2df21f14741ab27450823686a858191478027f9e28c1fd8ace2'
AND (
token = 'vly3AtEQU2mYGi7qwHy/3c5XM9b3bOpUfMArbOAmwSY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)