UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'niMOxb9qxLkaENl9AOxHikMFSQxFx934eHW8xECsqj8='
WHERE
key_id = '258bb19dd1926f260e43029790af921fe7b27998dbac2c684fc5bcbbd4db7226'
AND (
token = 'niMOxb9qxLkaENl9AOxHikMFSQxFx934eHW8xECsqj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)