UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ljzy7u2HU6VzWCwGSoOFi8WMG3xumx5ZBRF4QXB3ol8='
WHERE
key_id = '5051cda5b3ea8fc6a89011b9a4d196a38396a697aea6d2e640dc6e0d83847192'
AND (
token = 'ljzy7u2HU6VzWCwGSoOFi8WMG3xumx5ZBRF4QXB3ol8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)