UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BOgTsxobHCtJFKMVsuoXiNfeQ9xTWwqKv12eZYjTRVI='
WHERE
key_id = 'cc3099c37274b116ceed52b60583fe50c864a8296a91bfde954171ee4bc9bd55'
AND (
token = 'BOgTsxobHCtJFKMVsuoXiNfeQ9xTWwqKv12eZYjTRVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)