UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9YjOGi+7xKfgwFQZniF+Ywfzsjfrb8KM4UMlP65g6Ew='
WHERE
key_id = '4c7b3d71aab8ee012e9146d379c62eee77afc59ab2e8506ee85b73b75895958e'
AND (
token = '9YjOGi+7xKfgwFQZniF+Ywfzsjfrb8KM4UMlP65g6Ew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)