UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ddxa780BSg32fqEUm3jn8zCDohF1kdgiS/diDlK5LW4='
WHERE
key_id = 'bb78c31bf81a445e0b1a20b980f6992d31fe3e2b0c4f3417c220d63040913b5c'
AND (
token = 'ddxa780BSg32fqEUm3jn8zCDohF1kdgiS/diDlK5LW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)