UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5ssJTCHam8p4u6EAWiFp3VDww/aPpwSNBYjKjKUDtu4='
WHERE
key_id = 'b35a5ed0abcb51a3c51074b5fd4906da54c1332b177ecead648728b5ffbdd049'
AND (
token = '5ssJTCHam8p4u6EAWiFp3VDww/aPpwSNBYjKjKUDtu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)