UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TcbbXG4jpSJp7WRocJknsjQOtWz8AGkZpNg3w6o7w3w='
WHERE
key_id = '79449e697b0247d3197385f75da2921a31ac10a1fcc1775cff1fbc2ed65b4e2f'
AND (
token = 'TcbbXG4jpSJp7WRocJknsjQOtWz8AGkZpNg3w6o7w3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)