UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0Dzjb4YhuKdj4qP6p0490iZcEJ+O0Ur1mGnOY7f9nW4='
WHERE
key_id = '5bf743edf717b694d59dbbc67c626a9b091768cf023cd01517f835bd293c0e20'
AND (
token = '0Dzjb4YhuKdj4qP6p0490iZcEJ+O0Ur1mGnOY7f9nW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)