UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AabgouHY/i6ETHhTwL9bYEPrUwqfKbCq4zVbnmG3wTE='
WHERE
key_id = '39d9d955c1d3d191b15c8b3f1b5e723917f1f6e3f7da4c2f7cfea88f50c0e591'
AND (
token = 'AabgouHY/i6ETHhTwL9bYEPrUwqfKbCq4zVbnmG3wTE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)