UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dbuBgNVUaiEerVLzn91lHiEfkpSO8ve3lp/zCdYbxk8='
WHERE
key_id = 'a7f1024453fdecccc8cf104fb37deca2ef84d57f3bc2620e8585b9d2f25be779'
AND (
token = 'dbuBgNVUaiEerVLzn91lHiEfkpSO8ve3lp/zCdYbxk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)