UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oRCW0AYRCvrxFtg5YchkedO/ms+GMGnHALrHE9YLK/E='
WHERE
key_id = 'ec8b0a0776f5b58a045b44b4830f42a2106820b9f3a352e48082287a6531e0cf'
AND (
token = 'oRCW0AYRCvrxFtg5YchkedO/ms+GMGnHALrHE9YLK/E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)