UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hAvkt6pLjtlS7hcD2CuFY4Nmxsv3OMd9YBIMsFNsYYk='
WHERE
key_id = '3e24e719d35e9d0d783e29352f0f825bf1f34dce37314e90f5ed1e59eda9ec4b'
AND (
token = 'hAvkt6pLjtlS7hcD2CuFY4Nmxsv3OMd9YBIMsFNsYYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)