UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bhKgFwHMsQdEZH5sumEm0AaYz0Puv5UbXH+9wVUiwmE='
WHERE
key_id = 'a6d76c0d8ca9d0be067e86236bf6d57d714135eebaabbd2fc360fdc506121b07'
AND (
token = 'bhKgFwHMsQdEZH5sumEm0AaYz0Puv5UbXH+9wVUiwmE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)