UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NKwz4AUooTKFMXXaq+PhULMvY51bSuIpBYcrFNM90Tw='
WHERE
key_id = '89325ee59eba883de94c75c065f94bbde2ee0c3734834f2354040af6d138d42d'
AND (
token = 'NKwz4AUooTKFMXXaq+PhULMvY51bSuIpBYcrFNM90Tw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)