UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TtnAgINYr5/8IgwD6YK4ScY4173/sW1btC4WCGq2FqI='
WHERE
key_id = 'c6cb380740ec20ee85c04b32398d6bc3426991534f1f82b817016b34c823262d'
AND (
token = 'TtnAgINYr5/8IgwD6YK4ScY4173/sW1btC4WCGq2FqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)